The replace method actually accepts a substring or a regular expression and a replacement string as its second parameter, replaces all matches with the replacement string, and returns the updated string. replace方法实际上接受子字符串或正则表达式和替换字符串作为其第二个参数,用替换字符串更换所有匹配项,并返回更新的字符串。